export default {
	async getMarks() {
		let params = this.searchCondition;
		params.status=this.currentType;
		let res=await this.httptool.post(this.apis.getmMarkList,params);
		this.tableData =res.data.list;
		this.total=res.data.total;
	},
	async getMarkDetail(id) {
		let params = {
			id: id
		};
		let res=await this.httptool.post(this.apis.getMarkDetail,params);
		this.modelData = res.data;
		this.imgsUrl = [];
		var urls = res.imgsUrl;
		this.tool.getImgUrlArr(res.data.imgsUrl, this.imgsUrl); //分割图片数组
			if(this.from == '/imgPre') {				
				if(this.$store.state.savedPosition) {	
					setTimeout(() => {			
						$('html,body').scrollTop(this.$store.state.savedPosition);						
						this.$store.commit('changeValue', {
							name: 'savedPosition',
							value: null
						})
					}, 10)
				}
			}
		
	},
	async delMark(id) {
		let params = {
			subjectMatterId: id,
			traffickerId: this.id
		};
		this.httptool.ajaxPost(this.apis.deleteMark, params, function(res) {

		});
	},
	async getProductPrice(id) {
		let params = {
			id: id,
			pageNum: 1,
			pageSize: 10
		};
		let res=await this.httptool.post(this.apis.getProductPrice,params);
		this.tableData = res.data.list;
		
	},
	async release() {
		let rule = [{
			name: 'matterType',
			label: '产品',
			rule: ['validateSelectEmpty_']
		}, {
			name: 'title',
			label: '求购标题',
			rule: ['validateEmpty_']
		}, {
			name: 'qty',
			label: '招标数量',
			rule: ['validateEmpty_']
		}, {
			name: 'contactName',
			label: '联系人',
			rule: ['validateEmpty_']
		}, {
			name: 'contactTel',
			label: '联系电话',
			rule: ['validateTel_']
		}, {
			name: 'contactEmail',
			label: '邮箱',
			rule: ['validateMail_']
		}, {
			name: 'expirationDate',
			label: '截止时间',
			rule: ['validateEmpty_']
		}, {
			name: 'addressPre',
			label: '收货地址',
			rule: ['validateEmpty_']
		}, {
			name: 'addressDetail',
			label: '详细地址',
			rule: ['validateEmpty_']
		}];
		if(!this.validatetool.validate(this, this.params, rule)) {
			return;
		}
		this.params.imgs = this.info.imgs.join(',');

		let res=await this.httptool.post('mark/release',this.params);
		this.$message('发标成功！');
		this.$router.push('/marks');
		
	}

}